#include <stdio.h>
#include <string.h>
#include <math.h>
int main()
{
	char str[33];
	int i,t=-1,sum=0;
	printf("Input a binary number:\n");
	gets(str);
	for(i=strlen(str)-1;i>=0;i--)
	{
		t++;
		sum+=(str[i]-'0')*pow(2,t);
	}
	printf("The number is %d in decimal.\n",sum);
	printf("The number is %o in octal.\n",sum);
	printf("The number is %X in hexadecimal.\n",sum);	
	return 0;
}
